﻿@model CatalogPagingFilteringModel.SpecificationFilterModel
@using Nop.Web.Models.Catalog;
@{
    var renderedAttributeNames = new List<string>();
}
@if (Model.Enabled)
{
    <div class="product-filters product-spec-filter">
        <div class="filter-title">
            <span>@T("Filtering.SpecificationFilter")</span>
        </div>
        <div class="filter-content">
            @if (Model.NotFilteredItems.Count > 0)
            {
                <div class="available-items">
                    @foreach (var item in Model.NotFilteredItems)
                    {
                        if (!renderedAttributeNames.Contains(item.SpecificationAttributeName))
                        {
                            renderedAttributeNames.Add(item.SpecificationAttributeName);
                        <div class="group">
                            @item.SpecificationAttributeName
                        </div>
                        }
                        <div class="item">
                            <a href="@item.FilterUrl">@item.SpecificationAttributeOptionName</a>
                        </div>
                    }
                </div>
            }
            @if (Model.AlreadyFilteredItems.Count > 0)
            {
                <div class="already-filtered-items">
                    <div class="filter-title">
                        @T("Filtering.SpecificationFilter.CurrentlyFilteredBy")
                    </div>
                    @foreach (var item in Model.AlreadyFilteredItems)
                    {
                        <div class="item">
                            <strong>@(item.SpecificationAttributeName):</strong> @item.SpecificationAttributeOptionName
                        </div>
                    }
                </div>
                <div class="remove-filter">
                    <a href="@Model.RemoveFilterUrl">@T("Filtering.SpecificationFilter.Remove")</a>
                </div>
            }
        </div>
    </div>
}